package main

/*
问题：
1、使用 redis benchmark 工具, 测试 10 20 50 100 200 1k 5k 字节 value 大小，redis get set 性能。
2、写入一定量的 kv 数据, 根据数据大小 1w-50w 自己评估, 结合写入前后的 info memory 信息  , 
分析上述不同 value 大小下，平均每个 key 的占用内存空间。

以上作业，要求提交到自己的 GitHub 上面，然后把自己的 GitHub 地址填写到班班提供的表单中：
 https://jinshuju.net/f/C0huuc
*/


/*
问题1


分别执行如下命令：
redis-benchmark -d 10
redis-benchmark -d 20
redis-benchmark -d 50
redis-benchmark -d 100
redis-benchmark -d 200
redis-benchmark -d 1024
redis-benchmark -d 5120

--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
运行结果如下：
====== SET ======
  100000 requests completed in 2.29 seconds
  50 parallel clients
  10 bytes payload
  keep alive: 1

82.84% <= 1 milliseconds
99.86% <= 2 milliseconds
99.95% <= 3 milliseconds
100.00% <= 3 milliseconds
43591.98 requests per second

====== GET ======
  100000 requests completed in 2.14 seconds
  50 parallel clients
  10 bytes payload
  keep alive: 1

83.38% <= 1 milliseconds
99.95% <= 2 milliseconds
100.00% <= 2 milliseconds
46641.79 requests per second


====== SET ======
  100000 requests completed in 2.19 seconds
  50 parallel clients
  20 bytes payload
  keep alive: 1

81.24% <= 1 milliseconds
99.52% <= 2 milliseconds
99.75% <= 4 milliseconds
99.80% <= 8 milliseconds
99.85% <= 11 milliseconds
99.97% <= 12 milliseconds
100.00% <= 12 milliseconds
45578.85 requests per second

====== GET ======
  100000 requests completed in 1.96 seconds
  50 parallel clients
  20 bytes payload
  keep alive: 1

85.60% <= 1 milliseconds
100.00% <= 1 milliseconds
50994.39 requests per second



====== SET ======
  100000 requests completed in 2.57 seconds
  50 parallel clients
  50 bytes payload
  keep alive: 1

74.38% <= 1 milliseconds
99.50% <= 2 milliseconds
99.65% <= 6 milliseconds
99.70% <= 11 milliseconds
99.94% <= 12 milliseconds
100.00% <= 12 milliseconds
38895.37 requests per second

====== GET ======
  100000 requests completed in 2.36 seconds
  50 parallel clients
  50 bytes payload
  keep alive: 1

80.99% <= 1 milliseconds
99.94% <= 2 milliseconds
99.95% <= 3 milliseconds
100.00% <= 3 milliseconds
42444.82 requests per second



====== SET ======
  100000 requests completed in 2.47 seconds
  50 parallel clients
  100 bytes payload
  keep alive: 1

74.51% <= 1 milliseconds
100.00% <= 2 milliseconds
40518.64 requests per second

====== GET ======
  100000 requests completed in 2.38 seconds
  50 parallel clients
  100 bytes payload
  keep alive: 1

80.13% <= 1 milliseconds
99.94% <= 2 milliseconds
99.96% <= 3 milliseconds
100.00% <= 3 milliseconds
42087.54 requests per second



====== SET ======
  100000 requests completed in 2.38 seconds
  50 parallel clients
  1024 bytes payload
  keep alive: 1

75.54% <= 1 milliseconds
99.90% <= 2 milliseconds
100.00% <= 2 milliseconds
41928.72 requests per second

====== GET ======
  100000 requests completed in 2.44 seconds
  50 parallel clients
  1024 bytes payload
  keep alive: 1

79.31% <= 1 milliseconds
99.95% <= 3 milliseconds
100.00% <= 3 milliseconds
41017.23 requests per second


====== SET ======
  100000 requests completed in 2.73 seconds
  50 parallel clients
  5120 bytes payload
  keep alive: 1

60.27% <= 1 milliseconds
99.74% <= 2 milliseconds
99.95% <= 4 milliseconds
100.00% <= 4 milliseconds
36576.45 requests per second

====== GET ======
  100000 requests completed in 2.73 seconds
  50 parallel clients
  5120 bytes payload
  keep alive: 1

64.83% <= 1 milliseconds
99.89% <= 2 milliseconds
99.95% <= 3 milliseconds
100.00% <= 3 milliseconds
36670.33 requests per second
*/